
package NewGuy;

/**
 * Camera.java
 * Created on May 6, 2014
 * Author Joe Porter
 */

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.util.glu.GLU.*;
public class Camera {

        private float 
                    x,y,z,
                    rX,
                    rY,
                    rZ;
        
        private float 
                    fov,
                    aspectRatio,
                    nearPlane,
                    farPlane;
        
        public Camera(float fov, float aspect, float near, float far){
            
            x=0;
            y=0;
            z=0;
            rX=0;
            rY=0;
            rZ=0;
            
            this.fov=fov;
            this.aspectRatio = aspect;
            this.nearPlane = near;
            this.farPlane = far;
            initProjection();
        }
        
        private void initProjection(){
            glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluPerspective(fov, aspectRatio, nearPlane, farPlane);
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            glEnable(GL_DEPTH_TEST);
            
        }
                
                        
        public void useView(){
            glRotatef(rX, 1, 0, 0);
            glRotatef(rY, 0, 1, 0);
            glRotatef(rZ, 0, 0, 1);
            
            glTranslatef(x, y, z);
            
        }              
        public float getX(){
            return x;
        }
        public float getY(){
            return y;
        }
        public float getZ(){
            return z;
        }
        public void setX(float x){
            this.x=x;
        }
        public void setY(float y){
            this.y=y;
        }
        public void setZ(float z){
            this.z=z;
        }
        public float getRX(){
            return rX;
        }
        public float getRY(){
            return rY;
        }
        public float getRZ(){
            return rZ;
        }
        public void setRX(float rX){
            this.rX=rX;
        }
        public void setRY(float rY){
            this.rY=rY;
        }
        public void setRZ(float rZ){
            this.rZ=rZ;
        }
        
        
        
        
}
